Imports System.Xml
Imports System.Data.SqlClient
Public Class dTipoTalonario
 
    Public Function Existe(ByVal Letra As String, ByVal Descripcion As String) As Boolean
        Return BuscarFiltrado("", Letra, Descripcion).Tables(0).Rows.Count > 0
    End Function
    Public Function Insertar(ByVal Letra As String, ByVal Descripcion As String) As Boolean
        Dim Parametros As ArrayList = New ArrayList
        Parametros.Add(New SqlParameter("@pELetra", Letra))
        Parametros.Add(New SqlParameter("@pEDescripcion", Descripcion))
        Return dConexion.ABM("STORE_TblTipoTalonarioAlta", Parametros)
    End Function
    Public Function Eliminar(ByVal IdTipoTalonario As String) As Boolean
        Dim Parametros As ArrayList = New ArrayList
        Parametros.Add(New SqlParameter("@pEIdTipoTalonario", IdTipoTalonario))
        Return dConexion.ABM("STORE_TblTipoTalonarioELIMINAR", Parametros)
    End Function
    Public Function Modificar(ByVal IdTipoTalonario As String, ByVal Letra As String, ByVal Descripcion As String) As Boolean
        Dim Parametros As ArrayList = New ArrayList
        If IdTipoTalonario <> "" Then
            Parametros.Add(New SqlParameter("@pEIdTipoTalonario", IdTipoTalonario))
            If Letra <> "" Then
                Parametros.Add(New SqlParameter("@pELetra", Letra))
            End If
            If Descripcion <> "" Then
                Parametros.Add(New SqlParameter("@pEDescripcion", Descripcion))
            End If
        End If
        Return dConexion.ABM("STORE_TblTipoTalonarioMODIFICAR", Parametros)
    End Function
    Public Function BuscarFiltrado(ByVal IdTipoTalonario As String, ByVal Letra As String, ByVal Descripcion As String) As DATASET
        Dim Parametros As ArrayList = New ArrayList
        If IdTipoTalonario <> "" Then
            Parametros.Add(New SqlParameter("@pEIdTipoTalonario", IdTipoTalonario))
        End If
        If Letra <> "" Then
            Parametros.Add(New SqlParameter("@pELetra", Letra))
        End If
        If Descripcion <> "" Then
            Parametros.Add(New SqlParameter("@pEDescripcion", Descripcion))
        End If
        Return dConexion.Consultar("STORE_TblTipoTalonarioBUSCARFILTRADO", Parametros)
    End Function
    Public Function Listar() As DataSet
        Return dConexion.Consultar("STORE_TblTipoTalonarioBUSCARFILTRADO", New ArrayList)
    End Function
End Class
